<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.9.0.min.js"></script>
    <style>
        body{
            padding: 0;
            margin: 0;
        }

        .ul1{
            padding: 0;
            margin: 0;
            list-style: none;
            width: 100%;
            height: 40px;
            background-color: #a800f5;
        }

        .ul1 li{
            float: left;
            width: 100px;
            height: 40px;
            line-height: 40px;
            margin-right: 5px;
            text-align: center;
        }

        .ul2{
            display: none;
            padding: 0;
            margin: 0;
            list-style: none;
        }

        .ul2 li{
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background-color: #4F3E8A;
        }
    </style>
</head>
<body>
<ul class="ul1">
    <li>
        导航1
        <ul class="ul2">
            <li>下拉1</li>
            <li>下拉1</li>
            <li>下拉1</li>
        </ul>
    </li>
    <li>
        导航2
        <ul class="ul2">
            <li>下拉1</li>
            <li>下拉1</li>
            <li>下拉1</li>
        </ul>
    </li>
    <li>
        导航3
        <ul class="ul2">
            <li>下拉1</li>
            <li>下拉1</li>
            <li>下拉1</li>
        </ul>
    </li>
    <li>
        导航4
        <ul class="ul2">
            <li>下拉1</li>
            <li>下拉1</li>
            <li>下拉1</li>
        </ul>
    </li>
    <li>
        导航5
        <ul class="ul2">
            <li>下拉1</li>
            <li>下拉1</li>
            <li>下拉1</li>
        </ul>
    </li>
</ul>
</body>
</html>
<script>
    var last="";
    $(function () {
        $(".ul1 li").click(function () {
            $(".ul1 li").css("background-color","#a800f5");
            $(this).css("background-color","#004A8A");
            $(".ul2").hide("normal","swing");
            var val=$(this).text();
            if(last==(val+"down")){
                $(this).children().hide("normal","swing");
                last=val+"up";
            }else{
                $(this).children().show("normal","swing");
                last=val+"down";
            }
        })
    })
</script>